<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui" >
<ui:composition template="/pages/protected/user/default.xhtml">
     <ui:define name="content"> 
     <h3>Admin only</h3>
          <!--  <ui:insert name="content"></ui:insert> -->
          <h:form>
          <h:dataTable value="#{userMB.allUsers}" var="user" styleClass="table" headerClass="tableColumnsHeader" rowClasses="tableFirstLine,tableNextLine" >
			<h:column>
				<f:facet name="header">
					#{msgs.Name}
				</f:facet>
				
				#{user.name}
			</h:column>
			<h:column>
				<f:facet name="header">
					#{msgs.loginUserName}
				</f:facet>
				
				#{user.username}
			</h:column>
			<h:column>
				<f:facet name="header">
					Role
				</f:facet>
				
				#{user.role}
			</h:column>
			<h:column>
				<h:panelGrid columns="2">
					<h:inputHidden value="#{user.id}" />
					<h:commandButton action="#{userMB.deleteUser()}" value="#{msgs.delete}" >
						<f:setPropertyActionListener target="#{userMB.user}" value="#{user}" />
					</h:commandButton>
				</h:panelGrid>
			</h:column>
			<h:column>
				<h:panelGrid columns="2">
					<h:inputHidden value="#{user.id}" />
					<h:commandButton action="#{userMB.goToTransactions}" value="#{msgs.visitData}" >
						<f:setPropertyActionListener target="#{userMB.user}" value="#{user}" />
					</h:commandButton>
				</h:panelGrid>
			</h:column>
		</h:dataTable>
		</h:form>

    </ui:define>
</ui:composition>

</html>